package com.zj.core.ui

import android.content.Context
import android.support.constraint.ConstraintLayout
import android.view.Gravity
import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.LinearLayout
import com.zj.core.R
import org.jetbrains.anko.*
import org.jetbrains.anko.constraint.layout.constraintLayout
import org.jetbrains.anko.constraint.layout.guideline

class RefuseActivityUi(groupView: LinearLayout):AnkoComponent<Context>{
    private var view: LinearLayout=groupView
    lateinit var details_input_tv:EditText
    lateinit var commit_text_tv:Button

    override fun createView(ui: AnkoContext<Context>): View= with(view){
        constraintLayout {
            lparams(width= matchParent,height= matchParent)
            backgroundColor=context.resources.getColor(R.color.colorsFrenchWhite)

            guideline{
                id= R.id.guideline_h_40
            }.lparams(width= matchParent,height= wrapContent){
                orientation= ConstraintLayout.LayoutParams.HORIZONTAL
                guidePercent=0.4F
            }

            details_input_tv=editText {
                id=R.id.details_input_tv
                gravity=Gravity.START
                hint="您的意见是我们前进的动力！"
                textSize=dip(12).toFloat()
                padding=dip(8)
                background=context.resources.getDrawable(R.drawable.bordle_line_detail_item)
            }.lparams(width= matchParent,height= 0){
                margin=dip(8)
                bottomToTop=R.id.guideline_h_40
                leftToLeft= ConstraintLayout.LayoutParams.PARENT_ID
                rightToRight=ConstraintLayout.LayoutParams.PARENT_ID
                topToTop=ConstraintLayout.LayoutParams.PARENT_ID
            }

            commit_text_tv=button{
                id=R.id.commit_text_tv
                gravity=Gravity.CENTER
                text="提交"
                textColor=context.resources.getColor(R.color.colorsWhite)
                backgroundColor=context.resources.getColor(R.color.colorsPink)
            }.lparams(width=0,height= wrapContent){
                setPadding(0,dip(16),0,dip(16))
                leftToLeft=R.id.details_input_tv
                rightToRight=R.id.details_input_tv
                topToBottom=R.id.guideline_h_40
            }
        }
    }
}